home *** CD-ROM | disk | FTP | other *** search
- unit TerminalServices;
-
- { conversions from WTSAPI32.H }
-
- interface
-
- Uses Windows;
-
- {$MINENUMSIZE 4 - enumerations must be 32-bit values }
-
- Const
- WTS_CURRENT_SERVER_HANDLE = 0;
- WTS_CURRENT_SESSION = DWORD(-1);
-
- Type
- TConnectState = ( { WTS_CONNECTSTATE_CLASS }
- WTSActive, { User logged on to WinStation }
- WTSConnected, { WinStation connected to client }
- WTSConnectQuery, { In the process of connecting to client }
- WTSShadow, { Shadowing another WinStation }
- WTSDisconnected, { WinStation logged on without client }
- WTSIdle, { Waiting for client to connect }
- WTSListen, { WinStation is listening for connection }
- WTSReset, { WinStation is being reset }
- WTSDown, { WinStation is down due to error }
- WTSInit); { WinStation in initialization }
-
- PProcessInfo = ^TProcessInfo;
- TProcessInfo = Record { WTS_PROCESS_INFOA }
- SessionID : Integer;
- ProcessID : Integer;
- ProcessName : PChar;
- UserSID : PSID;
- End;
-
- PProcessInfoArray = ^TProcessInfoArray;
- TProcessInfoArray = Array[0..0] of TProcessInfo;
-
- PSessionInfo = ^TSessionInfo;
- TSessionInfo = Record { WTS_SESSION_INFOA }
- SessionID : Integer;
- WindowStation : PChar;
- State : TConnectState;
- End;
-
- PSessionInfoArray = ^TSessionInfoArray;
- TSessionInfoArray = Array[0..0] of TSessionInfo;
-
- TInfoClass = ( { WTS_INFO_CLASS }
- WTSInitialProgram,
- WTSApplicationName,
- WTSWorkingDirectory,
- WTSOEMId,
- WTSSessionId,
- WTSUserName,
- WTSWinStationName,
- WTSDomainName,
- WTSConnectState,
- WTSClientBuildNumber,
- WTSClientName,
- WTSClientDirectory,
- WTSClientProductId,
- WTSClientHardwareId,
- WTSClientAddress,
- WTSClientDisplay,
- WTSClientProtocolType);
-
- Function ProcessIdToSessionId(ProcessID : Integer; { from WINBASE.H }
- Var SessionID : Integer) : Bool; StdCall;
- External Kernel32 Name 'ProcessIdToSessionId';
-
- Function WTSEnumerateProcesses(Server : THandle; Reserved,Version : Integer;
- Var ProcessInfo : PProcessInfoArray; Var Count : Integer) : Bool; StdCall;
- External 'WTSAPI32.DLL' Name 'WTSEnumerateProcessesA';
-
- Function WTSEnumerateSessions(Server : THandle; Reserved,Version : Integer;
- Var SessionInfo : PSessionInfoArray; Var Count : Integer) : Bool; StdCall;
- External 'WTSAPI32.DLL' Name 'WTSEnumerateSessionsA';
-
- Procedure WTSFreeMemory(Memory : Pointer); StdCall;
- External 'WTSAPI32.DLL' Name 'WTSFreeMemory';
-
- Function WTSQuerySessionInformation(Server : THandle; SessionID : LongWord;
- Info : TInfoClass; Var Buf : Pointer;
- Var BytesReturned : Integer) : Bool; StdCall;
- External 'WTSAPI32.DLL' Name 'WTSQuerySessionInformationA';
-
- Function WTSSendMessage(Server : THandle; SessionID : LongWord; Title : PChar;
- TitleLength : Integer; AMessage : PCHar; MessageLength : Integer;
- Style,TimeOut : Integer; Var Response : Integer;
- Wait : Bool) : Bool; StdCall;
- External 'WTSAPI32.DLL' Name 'WTSSendMessageA';
-
- implementation
-
- end.
-